//
//  CHDeviceInfo.swift
//  bridging_js
//
//  Created by cyptt on 2021/8/10.
//

import UIKit

public class CHDeviceInfo: NSObject {
    
    
 
    /**
      infoDic
     */
    public static func infoDic() -> Dictionary<String, Any> {
        let infoDic:Dictionary = Bundle.main.infoDictionary!
        return infoDic
    }
    
    
  
    /**
        获取设app版本号
     */
    
    public static func  getAppVersion()->String {
        
        //获取app版本号
        let appVersion:String =  infoDic()["CFBundleShortVersionString"] as! String
        
        
        return appVersion
    }
   
    
    /**
     获取app名称
     */
    public static func  appDisplayName()->String {
        
        //获取app版本号
        let result:String
       
        if  infoDic()["CFBundleDisplayName"]  != nil {
            result =  infoDic()["CFBundleDisplayName"] as! String
        }else{
            result = ""
        }

        return result
    }
    
    /**
     小版本号
     */
    public static func  minorVersion()->String {
        
        //获取app版本号
        let result:String =  infoDic()["CFBundleVersion"] as! String
    
        return result
    }
    
    /**
     ios 系统版本
     */
    public static func iosVersion()->String{
        let result:String = UIDevice.current.systemVersion
        return result
    }
    
    /**
     udid
     */
    
    public static func deviceToken()->String{
        let result:String = UIDevice.current.identifierForVendor!.uuidString
   
        return result
    }
    
    /**
     设备型号
     */
    
    public static func deviceModel() -> String{
        let result = UIDevice.current.model
        return result
    }
    
    
    /**
     获取项目名
     */
    public static func getProjectName() -> String{
        let result:String =  infoDic()["CFBundleExecutable"] as! String
    
        return result
    }
}
